/*
 * AbstractMap.java
 * 
 * Created on Jun 17, 2007, 4:59:20 PM
 * 
 * Copyright (c) 2007 Daniel Gronau
 *
 * This file is part of KanjiTori.
 *
 * KanjiTori is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * KanjiTori is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

package kanjitori.map;

import com.jme.scene.Node;
import kanjitori.graphics.AbstractThing;
import kanjitori.map.ContentMatrix;
import kanjitori.map.Map;
import kanjitori.map.Position;

/**
 *
 * @author DGronau
 */
public abstract class AbstractMap extends AbstractThing implements Map {

    private String[] skyboxTextures;
    private int botCount;
    private String name;
    private Position size;
    private ContentMatrix contentMatrix;
    
    public AbstractMap() {
    }
    
    public AbstractMap(String name, Position size, String[] skyboxTextures, int botCount) {
        setName(name);
        setSize(size);
        setSkyboxTextures(skyboxTextures);
        setBotCount(botCount);
    }

    void setContentMatrix(ContentMatrix contentMatrix) {
        if (! size.equals(contentMatrix.getSize())) {
            throw new IllegalArgumentException("Size of Map and ContentMatrix not equal");
        }
        this.contentMatrix = contentMatrix;
    }
    
    public ContentMatrix getContentMatrix() {
        return contentMatrix;
    }

    void setSkyboxTextures(String... skyboxTextures) {
        this.skyboxTextures = skyboxTextures;
    }
    
    public String[] getSkyboxTextures() {
        return skyboxTextures;
    }
    
    void setBotCount(int botCount) {
        this.botCount = botCount;
    }

    public int getBotCount() {
        return botCount;
    }

    void setName(String name) {
        this.name = name;
    }
    
    public String getName() {
        return name;
    }
    
    void setSize(Position size) {
        this.size = size;
    }

    public Position getSize() {
        return size;
    }

    abstract public void init();
    
    public Node getNode() {
        if (node == null) {
            init();
        }
        return node;
    }

}
